import Taro from "@tarojs/taro";
import { useState } from "react";
import { RoleType } from "types/user";

export default function useRole() {
    const [role, setRole] = useState<RoleType>(Taro.getStorageSync("role") || RoleType.用户);
    return {
        role,
        update: function (value: RoleType) {
            setRole(value)
            Taro.setStorageSync("role", value)
        }
    }
}